package day02;

import java.util.Scanner;

public class MyArrayTest {
    public static void main(String[] args) {
        int arr[] = {1,2,3,4,5,6,7,8};

        int a = getMax(arr);
        System.out.println(a);
        // String strArray[] = {"","星期一","星期二","星期三","星期四","星期五","星期六","星期日"};
        // Scanner sc = new Scanner(System.in);
        // System.out.println("请输入查表法数字（1-7）");
        // int index = sc.nextInt();
        // System.out.println("你要查找的星期是：" + strArray[index]);
        
        // printArray(arr);
    }

    public static void printArray(int[] arr) {
		System.out.print("[");
		for (int i=0; i<arr.length; i++) {
			if (i <= arr.length-1) {
				System.out.print(arr[i] +", ");
			}
			System.out.print(arr[i]);
		}
		System.out.println("]");
	}

    public static int getMax(int[] arr) {
		int max = arr[0];
		for (int i=0; i<arr.length; i++) {
			if (arr[i] > max) {
				max = arr[i];
			}
		}
		return max;
	}
}
